<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MRSL Motion Primitive Library: include/mpl_basis/math.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MRSL Motion Primitive Library
   &#160;<span id="projectnumber">1.2</span>
   </div>
   <div id="projectbrief">A motion primitive library for generating trajectory for mobile robots</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_8b04de6a62aca813b0b7abde855cede7.html">mpl_basis</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">math.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Polynomial roots solver.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;<a class="el" href="data__type_8h_source.html">mpl_basis/data_type.h</a>&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
<code>#include &lt;unsupported/Eigen/Polynomials&gt;</code><br />
</div>
<p><a href="math_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a8291616c7876f84555d3ceab3a8092da"><td class="memItemLeft" align="right" valign="top"><a id="a8291616c7876f84555d3ceab3a8092da"></a>
<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&#160;</td><td class="memItemRight" valign="bottom"><b>normalize_angle</b> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> angle)</td></tr>
<tr class="separator:a8291616c7876f84555d3ceab3a8092da"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5b1ef571b298b14e320d7d9f31528871"><td class="memItemLeft" align="right" valign="top"><a id="a5b1ef571b298b14e320d7d9f31528871"></a>
std::vector&lt; <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#a5b1ef571b298b14e320d7d9f31528871">quad</a> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> b, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> c, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> d)</td></tr>
<tr class="memdesc:a5b1ef571b298b14e320d7d9f31528871"><td class="mdescLeft">&#160;</td><td class="mdescRight">Quadratic equation: <img class="formulaInl" alt="$b*t^2+c*t+d = 0$" src="form_0.png"/>. <br /></td></tr>
<tr class="separator:a5b1ef571b298b14e320d7d9f31528871"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af270499b7f6d6b2bb04528b3d46adec3"><td class="memItemLeft" align="right" valign="top"><a id="af270499b7f6d6b2bb04528b3d46adec3"></a>
std::vector&lt; <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#af270499b7f6d6b2bb04528b3d46adec3">cubic</a> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> a, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> b, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> c, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> d)</td></tr>
<tr class="memdesc:af270499b7f6d6b2bb04528b3d46adec3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cubic equation: <img class="formulaInl" alt="$a*t^3+b*t^2+c*t+d = 0$" src="form_1.png"/>. <br /></td></tr>
<tr class="separator:af270499b7f6d6b2bb04528b3d46adec3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11e53038927f416e637df83d4a0b18bc"><td class="memItemLeft" align="right" valign="top"><a id="a11e53038927f416e637df83d4a0b18bc"></a>
std::vector&lt; <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#a11e53038927f416e637df83d4a0b18bc">quartic</a> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> a, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> b, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> c, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> d, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> e)</td></tr>
<tr class="memdesc:a11e53038927f416e637df83d4a0b18bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Quartic equation: <img class="formulaInl" alt="$a*t^4+b*t^3+c*t^2+d*t+e = 0$" src="form_2.png"/>. <br /></td></tr>
<tr class="separator:a11e53038927f416e637df83d4a0b18bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a981120793ddb8cdf9ce466e8c2e70e4b"><td class="memItemLeft" align="right" valign="top">std::vector&lt; <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#a981120793ddb8cdf9ce466e8c2e70e4b">solve</a> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> a, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> b, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> c, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> d, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> e)</td></tr>
<tr class="memdesc:a981120793ddb8cdf9ce466e8c2e70e4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">General solver for <img class="formulaInl" alt="$a*t^4+b*t^3+c*t^2+d*t+e = 0$" src="form_2.png"/>.  <a href="#a981120793ddb8cdf9ce466e8c2e70e4b">More...</a><br /></td></tr>
<tr class="separator:a981120793ddb8cdf9ce466e8c2e70e4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac6a087eab8672b8862096d476893434b"><td class="memItemLeft" align="right" valign="top"><a id="ac6a087eab8672b8862096d476893434b"></a>
std::vector&lt; <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#ac6a087eab8672b8862096d476893434b">solve</a> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> a, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> b, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> c, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> d, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> e, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> f)</td></tr>
<tr class="memdesc:ac6a087eab8672b8862096d476893434b"><td class="mdescLeft">&#160;</td><td class="mdescRight">General solver for <img class="formulaInl" alt="$a*t^5+b*t^4+c*t^3+d*t^2+e*t+f = 0$" src="form_26.png"/>. <br /></td></tr>
<tr class="separator:ac6a087eab8672b8862096d476893434b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af81382faed5667c02f3f447c3eefd064"><td class="memItemLeft" align="right" valign="top"><a id="af81382faed5667c02f3f447c3eefd064"></a>
std::vector&lt; <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#af81382faed5667c02f3f447c3eefd064">solve</a> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> a, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> b, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> c, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> d, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> e, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> f, <a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> g)</td></tr>
<tr class="memdesc:af81382faed5667c02f3f447c3eefd064"><td class="mdescLeft">&#160;</td><td class="mdescRight">General solver for <img class="formulaInl" alt="$a*t^6+b*t^5+c*t^4+d*t^3+e*t^2+f*t+g = 0$" src="form_4.png"/>. <br /></td></tr>
<tr class="separator:af81382faed5667c02f3f447c3eefd064"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae1b37c26bb8e5744f5747d6cd6505356"><td class="memItemLeft" align="right" valign="top"><a id="ae1b37c26bb8e5744f5747d6cd6505356"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#ae1b37c26bb8e5744f5747d6cd6505356">factorial</a> (int n)</td></tr>
<tr class="memdesc:ae1b37c26bb8e5744f5747d6cd6505356"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return <img class="formulaInl" alt="$n!$" src="form_5.png"/>. <br /></td></tr>
<tr class="separator:ae1b37c26bb8e5744f5747d6cd6505356"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8a7fd3c51a3512fb0e8f4d70f8a93fac"><td class="memItemLeft" align="right" valign="top"><a id="a8a7fd3c51a3512fb0e8f4d70f8a93fac"></a>
<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="math_8h.html#a8a7fd3c51a3512fb0e8f4d70f8a93fac">power</a> (<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a> t, int n)</td></tr>
<tr class="memdesc:a8a7fd3c51a3512fb0e8f4d70f8a93fac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return <img class="formulaInl" alt="$t^n$" src="form_6.png"/>. <br /></td></tr>
<tr class="separator:a8a7fd3c51a3512fb0e8f4d70f8a93fac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c19fb4126f4784d48121ed8fdf95765"><td class="memTemplParams" colspan="2"><a id="a3c19fb4126f4784d48121ed8fdf95765"></a>
template&lt;typename Derived &gt; </td></tr>
<tr class="memitem:a3c19fb4126f4784d48121ed8fdf95765"><td class="memTemplItemLeft" align="right" valign="top">Derived::PlainObject&#160;</td><td class="memTemplItemRight" valign="bottom"><b>pseudoInverse</b> (Eigen::MatrixBase&lt; Derived &gt; const &amp;m)</td></tr>
<tr class="separator:a3c19fb4126f4784d48121ed8fdf95765"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab38166a64474597fb719aa62bd79212f"><td class="memTemplParams" colspan="2"><a id="ab38166a64474597fb719aa62bd79212f"></a>
template&lt;typename Derived &gt; </td></tr>
<tr class="memitem:ab38166a64474597fb719aa62bd79212f"><td class="memTemplItemLeft" align="right" valign="top">Derived::PlainObject&#160;</td><td class="memTemplItemRight" valign="bottom"><b>matrixSquareRoot</b> (Eigen::MatrixBase&lt; Derived &gt; const &amp;mat, bool semidefinite_mat=false)</td></tr>
<tr class="separator:ab38166a64474597fb719aa62bd79212f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Polynomial roots solver. </p>
<p>Solving real roots for n-th order polynomial: if n &lt; 5, the closed form solution will be calculated; if n &gt;= 5, using Eigen Polynomials solver which is slower but correct. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a981120793ddb8cdf9ce466e8c2e70e4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a981120793ddb8cdf9ce466e8c2e70e4b">&#9670;&nbsp;</a></span>solve()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;<a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&gt; solve </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&#160;</td>
          <td class="paramname"><em>d</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="data__type_8h.html#a7c99d9360fc6cac2762b786e2fb52266">decimal_t</a>&#160;</td>
          <td class="paramname"><em>e</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>General solver for <img class="formulaInl" alt="$a*t^4+b*t^3+c*t^2+d*t+e = 0$" src="form_2.png"/>. </p>
<p><img class="formulaInl" alt="$a, b, c$" src="form_3.png"/> can be zero. The function itself checks the highest order of the polynomial. </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
